package com.rock.upms.svc.model.service.impl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.rock.common.base.BaseModelService;
import com.rock.upms.model.UpmsThirdBind;
import com.rock.upms.model.UpmsThirdBindExample;
import com.rock.upms.svc.dao.model.mapper.UpmsThirdBindMapper;
import com.rock.upms.api.model.service.IUpmsThirdBindService;
import com.rock.upms.svc.model.service.impl.UpmsThirdBindService;
import com.rock.pkp.api.IPrimaryKeyService;
import com.rock.common.util.StringUtil;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.rock.common.annotation.ANNBaseService;
import org.springframework.stereotype.Repository;

/**
 * 功能： UpmsThirdBindService实现类
 * 说明： 
 * Created by zhousq on 2018/8/1.
 * 变更日志：   
 * 
 */

@ANNBaseService
@Repository
@Service
public class UpmsThirdBindService extends BaseModelService<UpmsThirdBindMapper, UpmsThirdBind, UpmsThirdBindExample> implements IUpmsThirdBindService {
    @Autowired
    UpmsThirdBindMapper upmsThirdBindMapper;
    	@Autowired
	private IPrimaryKeyService primaryKeyService;
	
		/**
		 * 方法名：insert(UpmsThirdBind record)<br>
		 * 功能： 自定义主键插入单条记录<br>
		 * 参数：record 实体对象 <br>
		 * 返回值：插入成功返回插入的主键，失败返回0
		 */
		@Override
		public int insert(UpmsThirdBind record) {
			// 根据实体类名转换为数据库表名,null表示默认主键名为ID
			int pk = primaryKeyService.getPrimaryKey(StringUtil.toTableName(UpmsThirdBind.class),null);
			if(pk==0){
				return 0;
			}
			record.setId(pk);
			int recordSize = upmsThirdBindMapper.insert(record);
			if (recordSize > 0) {
				return pk;
			} else {
				return 0;
			}
		}
	
		/**
		 * 方法名：insertSelective(UpmsThirdBind record)<br>
		 * 功能： 自定义主键插入单条记录<br>
		 * 参数：record 实体对象 <br>
		 * 返回值：插入成功返回插入的主键，失败返回0
		 */
		@Override
		public int insertSelective(UpmsThirdBind record) {
			// 根据实体类名转换为数据库表名,null表示默认主键名为ID
			int pk = primaryKeyService.getPrimaryKey(StringUtil.toTableName(UpmsThirdBind.class),null);
			record.setId(pk);
			int recordSize = upmsThirdBindMapper.insertSelective(record);
			if (recordSize > 0) {
				return pk;
			} else {
				return 0;
			}
		}
    
}